/**
 * Copyright 2016 Qiyi Inc. All rights reserved.
 *
 * @file:   StatisticOcr.Util.js
 * @path:   js-src/StatisticOcr/
 * @desc:
 * @author: zhang@qiyi.com
 * @date:   2016-03-28
 */
qui(function(require, exports, module){

    StatisticOcr.Util = $.extend(true, {}, Ancestor.Util, {
        buildTH: function (dataArr) {
            var retValue = [];
            $.each(dataArr, function (i, element) {
                retValue.push("<td>" + element + "</td>");
            });
            return "<tr>" + retValue.join("") + "</tr>";
        },
        buildTD: function (object, keyArr) {
            var retValue = [];
            $.each(keyArr, function (index, element) {
                var configData = StatisticOcr.Config.TABLE_COLMODEL_CONFIG[element]
                if (configData.formatter != null) {
                    retValue.push("<td>" + configData.formatter(object[configData.name], null, object) + "</td>");
                } else {
                    retValue.push("<td>" + object[configData.name] + "</td>");
                }
            });
            return "<tr>" + retValue.join("") + "</tr>";
        }
	});

});
